package com.ujoin.util;

import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
@Results({
	  @Result(name="success", location="/result.jsp"),
	  @Result(name="error", location="/result.jsp"),
	  @Result(name="input", location="/result.jsp")
	})
public class ActionEnhanced extends ActionSupport {
	private String json;
	
	public String getJson() {
		return json;
	}

	public void setJson(String json) {
		this.json = json;
	}
	
	@Override
	public void validate() {
		if (!this.hasErrors())
			return;
		json = JsonUtil.getError().setMessage(this.getFieldErrors()).toString();
		return;
	}
}
